package com.hexb.smh.entity.param.config;

import com.hexb.smh.entity.Config;
import com.hexb.smh.entity.enums.ConfigType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * @author : hexb
 */
@Data
public class ConfigParam {

    @ApiModelProperty(value = "配置的类型(目前仅2种类型)", example = "expression")
    @NotNull
    private ConfigType type;

    @ApiModelProperty(value = "配置的值", example = "0.5 * (A + B + C) + 100")
    @NotNull
    private String value;

    public Config toConfig() {
        Config config = new Config();
        config.setType(type);
        config.setValue(value);
        return config;
    }
}
